package com.shengchang.hu.supervision.Application;

import android.app.Application;

import com.olc.uhf.UhfAdapter;
import com.olc.uhf.UhfManager;
import com.shengchang.hu.supervision.Utils.Contants;
import com.shengchang.hu.supervision.Utils.SPManager;


/**
 * Created by Administrator on 2018/8/25 0025.
 */

public class App extends Application {

    public static UhfManager mService;
    public static String mversion="";
    public static int  m_version=2;

    public  static App sApp;

    public static App getApp()
    {
        return sApp;
    }


    public String getToken()
    {
        return SPManager.getInstance().getString(Contants.PREF_KEY_TOKEN, null);
    }
    public String getName()
    {
        return SPManager.getInstance().getString(Contants.NURSE_NAME_TEXT, null);
    }
    @Override
    public void onCreate() {
        super.onCreate();
        sApp = this;
        SPManager.getInstance().init(this);
        try {
            mService = UhfAdapter.getUhfManager(this.getApplicationContext());
            if (mService != null) {
                int status=mService.getStatus();
                m_version=((status&0xff0000)>>16)&0xff;
                if(mService.open()){
                    int b=0;
                }
            }
        } catch (Exception e) {
            //Toast.makeText(App.this, "dasd", Toast.LENGTH_SHORT).show();
        }
    }


    public void setToken(String paramString)
    {
        SPManager.getInstance().putString(Contants.PREF_KEY_TOKEN, paramString);
    }

    public void setName(String paramString)
    {
        SPManager.getInstance().putString(Contants.NURSE_NAME_TEXT, paramString);
    }


}
